[test optimization] Fix bug that makes some tags not visible on mocha tests with hooks#7912
Conversation
Overall package sizeSelf size: 5.47 MB Dependency sizes| name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.0.0 | 81.15 kB | 815.98 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |🤖 This report was automatically generated by heaviest-objects-in-the-universe |
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 910b31b | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback! |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7912 +/- ##
==========================================
- Coverage 74.35% 74.24% -0.12%
==========================================
Files 768 765 -3
Lines 35855 35784 -71
==========================================
- Hits 26660 26567 -93
- Misses 9195 9217 +22 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7912 +/- ##
==========================================
- Coverage 74.26% 74.25% -0.02%
==========================================
Files 769 769
Lines 36063 36068 +5
==========================================
Hits 26782 26782
- Misses 9281 9286 +5 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
BenchmarksBenchmark execution time: 2026-04-07 18:20:30 Comparing candidate commit 910b31b in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 228 metrics, 32 unstable metrics. |
juan-fernandez
left a comment
There was a problem hiding this comment.
great job! A small comment about readability
E2E Test Report: SUCCESS ✅Tested by: Shepherd Agent (autonomous QA for Datadog Test Optimization) Test Environment
ResultsCreated a dedicated mocha test file with
Tag Verification Detail (ATF — most comprehensive)
Test Methodology
This E2E test was performed by Shepherd — autonomous QA agent for Datadog Test Optimization |
… tests with hooks (#7912)
What does this PR do?
Fixes a bug where mocha tests with
afterEachhooks do not report certain tags. In particular, the following tags (grouped by functionality) are now being reported in mocha tests withafterEachhooks:Motivation
Mocha tests with
afterEachhooks were not reporting certain tags. This was because they were being lost when calling the hook handler (getOnHookEndHandler), since the tags were being computed in the local scope ofgetOnTestEndHandler. Solution was to include them in the contextctxobject, that is accesible fromgetOnHookEndHandlerafter leavinggetOnTestEndHandler's scope.